<style type="text/css">
<!--

.td-border-top {
	border-top: 1px solid #dedede;
}

.td-border-bottom {
	border-bottom: 1px solid #dedede;
}

.info-detail {
	border: 1px solid #dedede;
	padding: 10px;
	background: #fff;
	line-height: 2.5em;
}
td.dt-ct-header{
	width: 150px; 
	background: #dedede
}
td.dt-ct-header-final{
	background: #dedede
}
.dt-label {
	display: inline-block;
	width: 275px;
	vertical-align: top;
}

.dt-lb-content {
	padding: 1px;
	border-bottom: 1px dotted #666;
	display: inline-block;
	width: 300px;
}
.dt-lb-content + .dt-label{
	margin-left:115px;
}
div.dt-lb-content {
	padding: 15px;
	border: 1px dotted #666;
	line-height: normal;
	display: block;
	width: 900px;
}

div.dt-control {
	text-align: right;
	padding: 10px 10px;
}

div.dt-control a {
	color: #00f;
}
#page-content-right #inner .box-filter input.chkMajor{
	margin-top: 3px;
	margin-bottom: 2px;
	width: auto;
	margin-left: 20px;
}
label.chkNAV{
	display: inline-block;
	vertical-align: top;
	padding-top: 2px;
	padding-left: 5px;
}
img.pr-face{
	width: 200px;
	display: inline-block;
	border: 1px solid #ccc;
	float: left;
	margin-right: 30px;	
	min-height: auto;
}
input.button{
	padding:5px 10px;
	height:24px;
	background: url(/css/admin/img/global/button-bg.png) left center repeat-x;
	color:#fff;
	border:none;
	border-radius:5px;
	padding:4px 25px;
	cursor: pointer;
	width: auto;
}
.confirmation{
	margin-top: 20px;
	margin-bottom: 20px;
	text-align: center;
}
-->
</style>

<div class="info-detail" style="margin: 0px auto; width: 950px">
	<?php 
		if(empty($data['error'])):
		$val = $data['candidate'];
		$photos = CandidatePhotosTable::getListByCandidateId($val['id']);
	?>
	<img src="<?php echo empty($photos[0]['photo_url'])?sfConfig::get('app_no-image'):$photos[0]['photo_url']?>" class="pr-face"/>
	<div style="float: left;" >
		<label class="dt-label"><?php echo __('label_resource_id',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content">
		<?php
				$com = CandidateResourcesTable::getDataById ( $val ['resource_id'] );
				echo empty ( $com ['name'] ) ? 'N/A' : $com ['name']?>
		</span>
		
		<br/>
		<label class="dt-label"><?php echo __('head_name',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo $data['candidate']['full_name']?></span>
		
		<br/>
		<label class="dt-label"><?php echo __('label_identity_card',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo empty($val['identity_card'])?'&nbsp;':$val['identity_card'] ?></span>	
		
		
		<br /> 
		<label class="dt-label"><?php echo __('gender',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo __('gender_'.str_replace('-','_', $val['gender']), null, 'array_data') ?></span>
		
		<br/>
		<label class="dt-label"><?php echo __('label_date_of_birth',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo DateHelper::dateFormatFree($val['date_of_birth'], 'Y-m-d') ?></span>	
		
		<br/>
		<label class="dt-label"><?php echo __('is_married',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo __('married_'.str_replace('-','_', $val['is_married']), null, 'array_data') ?></span>
		
		<br/>
		<label class="dt-label"><?php echo __('working_experience_foreign',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo intval($val['working_experience_foreign'])?$val['working_experience_foreign']:__('experience_0', null, 'candidate_candidates'); ?></span>
		
		<br/>
		<label class="dt-label"><?php echo __('is_japan_training',  null, 'array_data')?></label>
		<span class="dt-lb-content"><?php echo __('is_japan_training_'.intval($val['is_japan_training']), null, 'array_data'); ?></span>
		
		<br/>
		<label class="dt-label"><?php echo __('label_education_text',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo empty($val['education'])?'&nbsp;':$val['education'] ?></span>	
		
		<br/>
		<label class="dt-label"><?php echo __('label_working_status',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo __('working_status_'.str_replace('-','_', $val['working_status']), null, 'array_data') ?></span>
		
		<br/>
		<label class="dt-label"><?php echo __('head_salary',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo intval($val['salary_require'])>0?('<span class="money-show">'.$data['salaries'][$val['salary_id']]['from'].'</span> - <span class="money-show">'.$data['salaries'][$val['salary_id']]['to'].'</span>'):__('label_salary_discuss',null,'candidate_candidates')?></span>
		
		
		<br/>
		<label class="dt-label"><?php echo __('head_work_area',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content">
			<?php
								$areas = LocationCitiesTable::getDataListByCandidateId($val ['id'] );
								$str = '';
								foreach ( $areas as $m ) :
									echo $str, $m ['name'];
									$str = ', ';
								endforeach;
							?>
		</span>
		
		<br/>
		<label class="dt-label"><?php echo __('phone_number',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo $val['phone_number'],  empty($val['otherphone'])?'':(' - '.$val['otherphone']) ?> </span>
		
		
		
		<br /> 
		<label class="dt-label"><?php echo __('label_address',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php 
		$city = LocationCitiesTable::getDataById($val['location_city_id']);
		$dist = LocationDistrictsTable::getDataById($val['location_district_id']);
		echo $val['address'],empty ($dist['name'])? '': (', '. $dist['name']), empty($city['name'])?'':(', '.$city['name']) ?></span>
		
	
		
		<br /> 
		<label class="dt-label"><?php echo __('label_home_address',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php
		$city = LocationCitiesTable::getDataById($val['home_city_id']);
		$dist = LocationDistrictsTable::getDataById($val['home_district_id']);
		echo $val['home_address'],empty ($dist['name'])? '': (', '. $dist['name']), empty($city['name'])?'':(', '.$city['name']) ?></span>
		
		<br /> 
		<label class="dt-label"><?php echo __('label_contact_address',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo $val['contact_address']?></span>
		
		
		<br/>
		<label class="dt-label"><?php echo __('label_email',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php echo empty($val['email'])?'&nbsp;':$val['email'] ?></span>
		
		<br/>
		<label class="dt-label"><?php echo __('label_documents',  null, 'candidate_candidates')?></label>
		<span class="dt-lb-content"><?php 
			$document = CandidateDocumentsTable::getListByCandidateId($val['id']);
			foreach($document as $doc):
			?>
			<a target="_blank" href="<?php echo $doc['document_url']?>" title="download"><?php echo $doc['file_name']?> &nbsp; <img src="/css/admin/img/global/download.png" width="16px"/></a> <br/>
			<?php 
			endforeach;
		?></span>
		
		<div class="clr"></div>
	</div>
	<div class="clr"></div>
	<br /> 	
	<label class="dt-label"><?php echo __('job_hope',  null, 'candidate_candidates')?></label><br />
	<div class="dt-lb-content" style="margin-left: 0px"><?php 
		$job_hope = CandidateJobHopesTable::getListByCandidateId($val['id']);
		foreach($job_hope as $m):
	?>
	<label class="dt-label"><?php echo $m['job_hope']?></label>
	<?php if(!empty($m['description'])):?>
		<div style="border:1px solid #dedede; padding:10px; margin-top:5px;"><?php echo html_entity_decode(nl2br($m['description']))?></div>
		<div class="clr"></div><br/>
	<?php endif;?>
	<div class="clr"></div><br/>
	<?php endforeach;?>
	<?php if (count($job_hope) == 0):
		echo __('no_information', null, 'table_list');
	endif?>
	</div>
	
	<br /> 
	<label class="dt-label"><?php echo __('label_education_history',  null, 'candidate_candidates')?></label><br />
	<table border="1" style="border-collapse: collapse; border-color: #ccc;width:930px; border:1px solid #ccc" cellpadding="2" cellspacing="0">
		<tr>
			<td class="dt-ct-header"><?php echo __('date_from', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('date_to', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header-final"><?php echo __('education_school', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('major_subject', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('education_level_id', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('is_checked', null, 'candidate_candidates')?></td>
		</tr>
		<?php 
		$educations  = CandidateEducationsTable::getDataList(array('filter_candidate_id'=>$val['id']));
		foreach($educations as $in):	
		$dateFrom = DateHelper::dateFormatFree($in['date_from'], 'Y-m');
		$dateTo = DateHelper::dateFormatFree($in['date_to'], 'Y-m');?>
		<tr>
			<td><?php echo $dateFrom ?></td>
			<td><?php echo $dateTo ?></td>
			<td><?php echo $in['education_school']?></td>
			<td><?php echo $in['major_subject']?></td>
			<td><?php echo $data['levels'][$in['education_level_id']]['name']?></td>
			<td><?php echo intval($in['is_checked'])?'<img src="/css/admin/img/global/control-enable.png"/>':'<img src="/css/admin/img/global/control-disable.png"/>'?></td>
		</tr>
	<?php endforeach; ?>
	<?php if (count($educations) == 0): ?>
		<tr>
			<td colspan="6">
				<?php echo __('no_information', null, 'table_list');?>
			</td>
		</tr>
		
	<?php endif?>
	</table>
	
	
	
	<br /> 
	<label class="dt-label"><?php echo __('label_language',  null, 'candidate_candidates')?></label><br />
	<table border="1" style="border-collapse: collapse; border-color: #ccc;width:930px; border:1px solid #ccc" cellpadding="2" cellspacing="0">
		<tr>
			<td class="dt-ct-header"><?php echo __('language_name', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('language_level', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header-final"><?php echo __('language_description', null, 'candidate_candidates')?></td>	
			<td class="dt-ct-header"><?php echo __('is_checked', null, 'candidate_candidates')?></td>
		</tr>
		<?php 
		$languages = CandidateToForeignLanguagesTable::getListByCandidateId($val['id']);
		foreach($languages as $m):	?>
		<tr>
			<td><?php echo $data['languages'][$m['foreign_language_id']]['name']?></td>
			<td><?php echo $data['language_levels'][$m['foreign_language_level_id']]['name']?></td>
			<td><?php echo html_entity_decode(nl2br($m['description']))?></td>
			<td><?php echo intval($m['is_checked'])?'<img src="/css/admin/img/global/control-enable.png"/>':'<img src="/css/admin/img/global/control-disable.png"/>'?></td>
		</tr>
	<?php endforeach; ?>
	<?php if (count($languages) == 0): ?>
		<tr>
			<td colspan="4">
				<?php echo __('no_information', null, 'table_list');?>
			</td>
		</tr>
		
	<?php endif?>
	</table>
	
	<br /> 
	<label class="dt-label"><?php echo __('label_information_technology',  null, 'candidate_candidates')?></label><br />
	<table border="1" style="border-collapse: collapse; border-color: #ccc;width:930px; border:1px solid #ccc" cellpadding="2" cellspacing="0">
		<tr>
			<td class="dt-ct-header"><?php echo __('information_technology_name', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('information_technology_level', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header-final"><?php echo __('information_technology_description', null, 'candidate_candidates')?></td>	
			<td class="dt-ct-header"><?php echo __('is_checked', null, 'candidate_candidates')?></td>
		</tr>
		<?php 
		$languages = CandidateToInformationTechnologiesTable::getListByCandidateId($val['id']);
		foreach($languages as $m):	?>
		<tr>
			<td><?php echo $data['technologies'][$m['information_technology_id']]['name']?></td>
			<td><?php echo $data['technology_levels'][$m['information_technology_level_id']]['name']?></td>
			<td><?php echo html_entity_decode(nl2br($m['description']))?></td>
			<td><?php echo intval($m['is_checked'])?'<img src="/css/admin/img/global/control-enable.png"/>':'<img src="/css/admin/img/global/control-disable.png"/>'?></td>
		</tr>
	<?php endforeach; ?>
	<?php if (count($languages) == 0): ?>
		<tr>
			<td colspan="4">
				<?php echo __('no_information', null, 'table_list');?>
			</td>
		</tr>
		
	<?php endif?>
	</table>
	
	
	<br /> 	
	<label class="dt-label"><?php echo __('more_skill',  null, 'candidate_candidates')?></label><br />
	<div class="dt-lb-content" style="margin-left: 0px"><?php 
		$skill = CandidateOtherSkillesTable::getListByCandidateId($val['id']);
		foreach($skill as $m):
	?>
	<label class="dt-label"><?php echo intval($m['is_checked'])?'<img src="/css/admin/img/global/control-enable.png"/>':'<img src="/css/admin/img/global/control-disable.png"/>'?>&nbsp;<?php echo $m['skill']?></label>
	<?php if(!empty($m['description'])):?>
		<div style="border:1px solid #dedede; padding:10px; margin-top:5px;"><?php echo html_entity_decode(nl2br($m['description']))?></div>
		<div class="clr"></div><br/>
	<?php endif;?>
	<div class="clr"></div><br/>
	<?php endforeach;?>
	<?php if (count($skill) == 0):
		echo __('no_information', null, 'table_list');
	endif?>
	</div>
	
	
	<br /> 
	<label class="dt-label"><?php echo __('label_working_history',  null, 'candidate_candidates')?></label><br />
	<table border="1" style="border-collapse: collapse; border-color: #ccc;width:930px; border:1px solid #ccc" cellpadding="2" cellspacing="0">
		<tr>
			<td class="dt-ct-header"><?php echo __('history_worktime', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('history_workyear', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('history_company_name', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('history_job_position_id', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header"><?php echo __('history_position_id', null, 'candidate_candidates')?></td>
			<td class="dt-ct-header-final"><?php echo __('history_description', null, 'candidate_candidates')?></td>
		</tr>
		<?php 
		$works = CandidateWorkingHistoriesTable::getDataList(array('filter_candidate_id' => $val['id']));
		foreach($works as $m):	
		$dateFrom = DateHelper::dateFormatFree($m['date_from'], 'Y-m');
		$dateTo = DateHelper::dateFormatFree($m['date_to'], 'Y-m');
		$year = intval(date('Y',strtotime($m['date_to']))) - intval(date('Y',strtotime($m['date_from'])));
		if (intval($year) == 0){
			$year = __('under_1_year', null, 'candidate_candidates' );
		}?>
		<tr>
			<td><?php echo $dateFrom, ' ~ ', $dateTo ?></td>
			<td><?php echo $year ?></td>
			<td><?php echo $m['company_name']?></td>
			<td><?php echo $data['job_positions'][$m['job_position_id']]['name']?></td>
			<td><?php echo $data['positions'][$m['position_id']]['name']?></td>
			<td><?php echo html_entity_decode(nl2br($m['work_description']))?></td>
		</tr>
	<?php endforeach; ?>
	<?php if (count($works) == 0): ?>
		<tr>
			<td colspan="6">
				<?php echo __('no_information', null, 'table_list');?>
			</td>
		</tr>
		
	<?php endif?>
	</table>
	
	<br /> 	
	<label class="dt-label"><?php echo __('label_major',  null, 'candidate_candidates')?></label><br />
	<div class="dt-lb-content" style="margin-left: 0px"><?php 
		$majors = CandidateToMajorsTable::getListByCandidateId($val['id']);
		foreach($majors as $m):
	?>
	<label class="dt-label"><?php echo $data['majors'][$m['major_id']]['name']?></label>
	<?php if(!empty($m['description'])):?>
		<div style="border:1px solid #dedede; padding:10px; margin-top:5px;"><?php echo html_entity_decode(nl2br($m['description']))?></div>
		<div class="clr"></div><br/>
	<?php endif;?>
	<div class="clr"></div><br/>
	<?php endforeach;?>
	<?php if (count($majors) == 0):
		echo __('no_information', null, 'table_list');
	endif?>
	</div>
	<br /> 	
	<label class="dt-label"><?php echo __('label_remark_more',  null, 'candidate_candidates')?></label><br />
	<div class="dt-lb-content" style="margin-left: 0px"><?php 
		$remark_more = CandidateRemarksTable::getListByCandidateId($val['id']);
		foreach($remark_more as $m):
	?>
	<label class="dt-label"><strong><?php echo DateHelper::dateFormatFree($m['remarked_at'], 'Y-m-d')?></strong></label>&nbsp;
	<div style="text-align: justify;"><?php echo $m['content']?></div>
	<div class="clr"></div><br/><br/>
	<?php endforeach;?>
	<?php if (count($remark_more) == 0):
		echo __('no_information', null, 'table_list');
	endif?>
	</div>
	<br/>
	<label class="dt-label"><?php echo __('label_remark',  null, 'candidate_candidates')?></label><br />
	<div class="dt-lb-content">
	<?php echo html_entity_decode(nl2br($val['remark']))?>
	</div>
	<br/>
	<label class="dt-label"><?php echo __('register_date',  null, 'candidate_candidates')?></label><br />
	<div class="dt-lb-content">
	<?php echo DateHelper::dateFormat($val['register_date'])?>
	</div>
	<div class="confirmation">
		<input type="button" onclick="window.location='?action_name=<?php echo ADMIN_DEFINED::ADD_RECORD?>'" value="<?php echo __('preview_save', null, 'table_list')?>" class="button"/>
		<input type="button" onclick="window.location='?action_name=<?php echo ADMIN_DEFINED::EDIT_RECORD?>&id=<?php echo $data['id']?>'" value="<?php echo __('preview_edit', null, 'table_list')?>" class="button"/>
		<input type="button" onclick="window.location='?action_name=<?php echo ADMIN_DEFINED::DELETE_RECORD?>&id=<?php echo $data['id']?>&sec=<?php echo $data['sec']?>'" value="<?php echo __('preview_delete', null, 'table_list')?>" class="button"/>
	</div>
	<?php else:?>
	<?php echo __('error_loading_detail', null, 'candidate_candidates')?>
	<?php endif?>
</div>
					